<template>
  <div style="height: 900px; padding: 20px; overflow: auto">
    <json-viewer :value="json_data" />
  </div>
</template>

<script>
import { get_user_log } from "@/api/user";
export default {
  name: "UserLog",

  data() {
    return {
      json_data: []
    }
  },
  created() {
    this.get_log()
    this.is_login()
  },
  methods: {
    is_login() {
      // eslint-disable-next-line no-prototype-builtins
      if (localStorage.hasOwnProperty("user_id") === false || localStorage.getItem("user_id") === '') {
        this.$router.push("/login")
        this.$message.error("未登录，请前往登录")
      }
    },
    get_log() {
      get_user_log({ "count": 100 }).then(res => {
        this.json_data = res.data.log_data
      })
    }
  }
}
</script>

<style lang="scss">

</style>
